package com.rc.saas.tenant.vo.order;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rc.saas.tenant.common.enums.*;
import com.rc.saas.tenant.common.utils.StringUtil;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

public class ExceptionOrderPrintVo {
    @ExcelProperty("状态")
    private String status;

    @ExcelProperty("桩群")
    private String stationName;
    // @ExcelProperty("互联互通运营商")

    @ExcelIgnore
    private String hlhtOrderType;

    @ExcelProperty("互联互通运营商")
    private String hlhtOperatorName;

    @ExcelProperty("所属分销商")
    private String operatorName;

    @ExcelProperty("订单类型")
    private String hlhtOrderTypeString;

    @ExcelProperty("互联类型")
    private String hlhtTypeString;

    @ExcelProperty("所属公司")
    private String companyName;

    @ExcelProperty("枪编号")
    private String gunNo;

    @ExcelProperty("订单号")
    private String orderNum;

    @ExcelProperty("外部订单号")
    private String outOrderNum;

    @ExcelProperty("会员名")
    private String nickname;

    @ExcelProperty("手机号")
    private String mobile;

    @ExcelProperty("车牌号")
    private String carNumber;

    @ExcelProperty("充电方式")
    private String accountType;

    @ExcelProperty("原始开始充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date hisStartTime;

    @ExcelProperty("原始结束充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date hisEndTime;

    @ExcelProperty("原始电量(度)")
    private BigDecimal hisPower;

    @ExcelProperty("原始基本电费(元)")
    private BigDecimal hisElecMoney;

    @ExcelProperty("原始服务费(元)")
    private BigDecimal hisServiceAmount;

    @ExcelProperty("原始总价格(元)")
    private BigDecimal hisTotalMoney;

    @ExcelProperty("原始优惠(元)")
    private BigDecimal hisDiscountAmount;

    @ExcelProperty("原始实付(元)")
    private BigDecimal hisPayAmount;

    @ExcelProperty("原始充电时长")
    private String hisLastTime;

    @ExcelProperty("原始开始soc")
    private BigDecimal hisBeginSoc;

    @ExcelProperty("原始结束soc")
    private BigDecimal hisSoc;

    @ExcelProperty("登记开始充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date exceptionStartTime;

    @ExcelProperty("登记结束充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date exceptionEndTime;

    @ExcelProperty("登记电量(度)")
    private BigDecimal exceptionTotalPower;

    @ExcelProperty("登记基本电费(元)")
    private BigDecimal exceptionTotalElecMoney;

    @ExcelProperty("登记服务费(元)")
    private BigDecimal exceptionTotalSeviceMoney;

    @ExcelProperty("登记总价格(元)")
    private BigDecimal exceptionTotalMoney;

    @ExcelProperty("登记优惠(元)")
    private BigDecimal exceptionDiscountAmount;

    @ExcelProperty("登记实付(元)")
    private BigDecimal exceptionPayAmount;

    @ExcelProperty("登记充电时长")
    private String exceptionLastTime;

    @ExcelProperty("登记开始soc")
    private BigDecimal exceptionBeginSoc;

    @ExcelProperty("登记结束soc")
    private BigDecimal exceptionSoc;

    /**电费差值*/
    @ExcelProperty("电费差值")
    private BigDecimal diffElecMoney;
    /**服务费差值*/
    @ExcelProperty("服务费差值")
    private BigDecimal diffServiceMoney;
    @ExcelProperty("实付差值")
    private BigDecimal diffPayAmount;
    /**解决办法*/
    @ExcelProperty("解决办法")
    private String solution;
    /**修复时间*/
    @ExcelProperty("修复时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date repairTime;
    /**状态*/
    @ExcelProperty("修复状态")
    private String exceptionStatus;

    @ExcelProperty("操作人")
    private String exceptionLastUpdatedBy;
    /**驳回原因*/
    @ExcelProperty("备注")
    private String rejectionReason;

    @ExcelIgnore
    private String orderInfoHlhtType;

    @ExcelIgnore
    private String elecServerDomain;

    @ExcelIgnore
    private Integer pileStopReason;

    @ExcelIgnore
    private String hlhtTenantCode;

    @ExcelIgnore
    private String hlhtOperatorId;

    @ExcelIgnore
    private String hlhtTenantName;

    @ExcelIgnore
    private String tenantOperatorCode;

    public BigDecimal getDiffPayAmount() {
        return diffPayAmount;
    }

    public void setDiffPayAmount(BigDecimal diffPayAmount) {
        this.diffPayAmount = diffPayAmount;
    }

    public String getTenantOperatorCode() {
        return tenantOperatorCode;
    }

    public void setTenantOperatorCode(String tenantOperatorCode) {
        this.tenantOperatorCode = tenantOperatorCode;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public Date getHisStartTime() {
        return hisStartTime;
    }

    public void setHisStartTime(Date hisStartTime) {
        this.hisStartTime = hisStartTime;
    }

    public Date getHisEndTime() {
        return hisEndTime;
    }

    public void setHisEndTime(Date hisEndTime) {
        this.hisEndTime = hisEndTime;
    }

    public BigDecimal getHisPower() {
        return hisPower;
    }

    public void setHisPower(BigDecimal hisPower) {
        this.hisPower = hisPower;
    }

    public BigDecimal getHisElecMoney() {
        return hisElecMoney;
    }

    public void setHisElecMoney(BigDecimal hisElecMoney) {
        this.hisElecMoney = hisElecMoney;
    }

    public BigDecimal getHisServiceAmount() {
        return hisServiceAmount;
    }

    public void setHisServiceAmount(BigDecimal hisServiceAmount) {
        this.hisServiceAmount = hisServiceAmount;
    }

    public BigDecimal getHisTotalMoney() {
        return hisTotalMoney;
    }

    public void setHisTotalMoney(BigDecimal hisTotalMoney) {
        this.hisTotalMoney = hisTotalMoney;
    }

    public BigDecimal getHisDiscountAmount() {
        return hisDiscountAmount;
    }

    public void setHisDiscountAmount(BigDecimal hisDiscountAmount) {
        this.hisDiscountAmount = hisDiscountAmount;
    }

    public BigDecimal getHisPayAmount() {
        return hisPayAmount;
    }

    public void setHisPayAmount(BigDecimal hisPayAmount) {
        this.hisPayAmount = hisPayAmount;
    }

    public String getHisLastTime() {
        return hisLastTime;
    }

    public void setHisLastTime(String hisLastTime) {
        this.hisLastTime = hisLastTime;
    }

    public BigDecimal getHisBeginSoc() {
        return hisBeginSoc;
    }

    public void setHisBeginSoc(BigDecimal hisBeginSoc) {
        this.hisBeginSoc = hisBeginSoc;
    }

    public BigDecimal getHisSoc() {
        return hisSoc;
    }

    public void setHisSoc(BigDecimal hisSoc) {
        this.hisSoc = hisSoc;
    }

    public String getHlhtTenantName() {
        return hlhtTenantName;
    }

    public void setHlhtTenantName(String hlhtTenantName) {
        this.hlhtTenantName = hlhtTenantName;
    }

    public String getHlhtTenantCode() {
        return hlhtTenantCode;
    }

    public void setHlhtTenantCode(String hlhtTenantCode) {
        this.hlhtTenantCode = hlhtTenantCode;
    }

    public String getHlhtOperatorId() {
        return hlhtOperatorId;
    }

    public void setHlhtOperatorId(String hlhtOperatorId) {
        this.hlhtOperatorId = hlhtOperatorId;
    }

    public Integer getPileStopReason() {
        return pileStopReason;
    }

    public void setPileStopReason(Integer pileStopReason) {
        this.pileStopReason = pileStopReason;
    }

    public BigDecimal getDiffElecMoney() {
        return diffElecMoney;
    }

    public void setDiffElecMoney(BigDecimal diffElecMoney) {
        this.diffElecMoney = diffElecMoney;
    }

    public BigDecimal getDiffServiceMoney() {
        return diffServiceMoney;
    }

    public void setDiffServiceMoney(BigDecimal diffServiceMoney) {
        this.diffServiceMoney = diffServiceMoney;
    }

    public String getSolution() {
        return solution;
    }

    public void setSolution(String solution) {
        this.solution = solution;
    }

    public Date getRepairTime() {
        return repairTime;
    }

    public void setRepairTime(Date repairTime) {
        this.repairTime = repairTime;
    }

    public String getExceptionStatus() {
        if ("0".equals(exceptionStatus)){
            return "待复核";
        } else if ("1".equals(exceptionStatus)) {
            return "待修复";
        } else if ("2".equals(exceptionStatus)) {
            return "待核销";
        } else if ("5".equals(exceptionStatus)) {
            return "已驳回";
        } else if ("6".equals(exceptionStatus)) {
            return "已完成";
        }
        return exceptionStatus;
    }

    public String getElecServerDomain() {
        return elecServerDomain;
    }

    public void setElecServerDomain(String elecServerDomain) {
        this.elecServerDomain = elecServerDomain;
    }

    public void setExceptionStatus(String exceptionStatus) {
        this.exceptionStatus = exceptionStatus;
    }

    public String getRejectionReason() {
        return rejectionReason;
    }

    public void setRejectionReason(String rejectionReason) {
        this.rejectionReason = rejectionReason;
    }

    public Date getExceptionStartTime() {
        return exceptionStartTime;
    }

    public void setExceptionStartTime(Date exceptionStartTime) {
        this.exceptionStartTime = exceptionStartTime;
    }

    public Date getExceptionEndTime() {
        return exceptionEndTime;
    }

    public void setExceptionEndTime(Date exceptionEndTime) {
        this.exceptionEndTime = exceptionEndTime;
    }

    public BigDecimal getExceptionTotalPower() {
        return exceptionTotalPower;
    }

    public void setExceptionTotalPower(BigDecimal exceptionTotalPower) {
        this.exceptionTotalPower = exceptionTotalPower;
    }

    public BigDecimal getExceptionTotalElecMoney() {
        return exceptionTotalElecMoney;
    }

    public String getHlhtOrderType() {
        return hlhtOrderType;
    }

    public void setHlhtOrderType(String hlhtOrderType) {
        this.hlhtOrderType = hlhtOrderType;
    }

    public String getAccountType() {
        return accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public String getOrderInfoHlhtType() {
        return orderInfoHlhtType;
    }

    public void setOrderInfoHlhtType(String orderInfoHlhtType) {
        this.orderInfoHlhtType = orderInfoHlhtType;
    }

    public void setExceptionTotalElecMoney(BigDecimal exceptionTotalElecMoney) {
        this.exceptionTotalElecMoney = exceptionTotalElecMoney;
    }

    public BigDecimal getExceptionTotalSeviceMoney() {
        return exceptionTotalSeviceMoney;
    }

    public void setExceptionTotalSeviceMoney(BigDecimal exceptionTotalSeviceMoney) {
        this.exceptionTotalSeviceMoney = exceptionTotalSeviceMoney;
    }

    public BigDecimal getExceptionTotalMoney() {
        return exceptionTotalMoney;
    }

    public void setExceptionTotalMoney(BigDecimal exceptionTotalMoney) {
        this.exceptionTotalMoney = exceptionTotalMoney;
    }

    public BigDecimal getExceptionDiscountAmount() {
        return exceptionDiscountAmount;
    }

    public void setExceptionDiscountAmount(BigDecimal exceptionDiscountAmount) {
        this.exceptionDiscountAmount = exceptionDiscountAmount;
    }

    public BigDecimal getExceptionPayAmount() {
        return exceptionPayAmount;
    }

    public void setExceptionPayAmount(BigDecimal exceptionPayAmount) {
        this.exceptionPayAmount = exceptionPayAmount;
    }

    public String getExceptionLastTime() {
        return exceptionLastTime;
    }

    public void setExceptionLastTime(String exceptionLastTime) {
        this.exceptionLastTime = exceptionLastTime;
    }

    public BigDecimal getExceptionBeginSoc() {
        return exceptionBeginSoc;
    }

    public void setExceptionBeginSoc(BigDecimal exceptionBeginSoc) {
        this.exceptionBeginSoc = exceptionBeginSoc;
    }

    public BigDecimal getExceptionSoc() {
        return exceptionSoc;
    }

    public void setExceptionSoc(BigDecimal exceptionSoc) {
        this.exceptionSoc = exceptionSoc;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public void setHlhtOperatorName(String hlhtOperatorName) {
        this.hlhtOperatorName = hlhtOperatorName;
    }

    public void setHlhtOrderTypeString(String hlhtOrderTypeString) {
        this.hlhtOrderTypeString = hlhtOrderTypeString;
    }

    public void setHlhtTypeString(String hlhtTypeString) {
        this.hlhtTypeString = hlhtTypeString;
    }

    public String getGunNo() {
        return gunNo;
    }

    public void setGunNo(String gunNo) {
        this.gunNo = gunNo;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getOutOrderNum() {
        return outOrderNum;
    }

    public void setOutOrderNum(String outOrderNum) {
        this.outOrderNum = outOrderNum;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }
    public String getCompanyName() {
        if ("0".equals(orderInfoHlhtType)) {
            if ("0".equals(hlhtOrderType)) {
                return companyName;
            } else if ("1".equals(hlhtOrderType)) {
                return companyName;
            } else if ("2".equals(hlhtOrderType)) {
                return "";
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            if ("1".equals(hlhtOrderType)) {
                return companyName;
            } else if ("2".equals(hlhtOrderType)) {
                return "";
            }
        } else if ("2".equals(orderInfoHlhtType)) {
            return "";
        }
        return "";
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getPileStopReasonString() {
        if ("SH_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ShStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("LNC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = LncStopReasonEnum.getLncStopReasonEnumByTenant(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JnStopReasonEnum.getMsgJnStopReason(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YL_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YlStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YC_DOMAIN".equals(elecServerDomain) || "ZC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ZcElecPileStopReasonEnum.getElecPileStopReasonResultWithInt(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("RS_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = RsStopReasonEnum.getStopReasonResultWithInt(this.getPileStopReason().toString());
            return stopReasonMsg;
        } else if ("YKR_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YkrPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JUN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JunStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        } else {
            //桩停止原因
            String elecPileStopReasonResult = ElecPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return elecPileStopReasonResult;
        }
    }

    public String getHlhtOrderTypeString() {
        if ("0".equals(orderInfoHlhtType)) {
            if ("0".equals(hlhtOrderType)) {
                return "自有订单";
            } else if ("1".equals(hlhtOrderType)) {
                return "反向订单";
            } else if ("2".equals(hlhtOrderType)) {
                return "正向订单";
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            if ("1".equals(hlhtOrderType)) {
                return "反向订单";
            } else if ("2".equals(hlhtOrderType)) {
                return "正向订单";
            }
        } else if ("2".equals(orderInfoHlhtType)) {
            return "正向订单";
        }
        return "";
    }

    public String getHlhtTypeString() {
        if ("0".equals(orderInfoHlhtType)) {
            if ("0".equals(hlhtOrderType)) {
                return "";
            } else if (StringUtil.isNotBlank(hlhtTenantCode) && !StringUtil.isNotBlank(hlhtOperatorId)) {
                return "内部互联";
            } else {
                return "外部互联";
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            return "内部互联";
        } else {
            return "内部互联";
        }
    }

    public String getHlhtOperatorName() {
        if ("0".equals(orderInfoHlhtType)) {
            if (StringUtil.isNotBlank(hlhtTenantCode) && !StringUtil.isNotBlank(hlhtOperatorId)) {
                return hlhtTenantName;
            } else {
                return hlhtOperatorName;
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            return hlhtTenantName;
        } else {
            return hlhtTenantName;
        }
    }

    public String getExceptionLastUpdatedBy() {
        return exceptionLastUpdatedBy;
    }

    public void setExceptionLastUpdatedBy(String exceptionLastUpdatedBy) {
        this.exceptionLastUpdatedBy = exceptionLastUpdatedBy;
    }
}
